import sys
from PySide2.QtWidgets import QApplication,QMenu, QAction, QSystemTrayIcon

import Resources

from UI.uiwidget import UIWidget

class SysTrayIcon(QSystemTrayIcon):
    def __init__(self, icon, parent=None):
        super().__init__(icon, parent)

        self.setToolTip(self.tr("UsageTool"))

        self.__DefineData()
        self.__InitData()
        self.__InitStyle()
        self.__InitSignalAndSlot()

    def __DefineData(self):

        # 主界面
        self.MainWidget = UIWidget()
        # self.MainWidget.show()

    def __InitData(self):

        self.setContextMenu(self.MainWidget.TrayMenu)

    def __InitStyle(self):
        pass

    def __InitSignalAndSlot(self):

        self.activated.connect(self.MainWidget.slotClickedTray)

